exports.withdrawAction = function (req, res) {

    //获取restful参数
    var restfulParams = req.routeInfo.restfulParams;

    var resultData = {};

    //任务流创建
    async.waterfall([


        function (cb) {

            R.SEND_HTTP(
                req,
                {
                    url: CORE_APIConfig.coreAPI.searchOrganization + "/o_id/" + restfulParams.o_id,
                    method: 'POST',
                    data:{
                        fields:['o_name',"o_phone"].join(',')
                    }
                },
                function (err, data) {

                    console.log(111,data);

                    resultData.organizationName = data.data[0].o_name;
                    resultData.organizationPhone = data.data[0].o_phone;

                    cb();
                }
            );

        },
        // function (cb) {

        //     R.SEND_HTTP(
        //         req,
        //         {
        //             url: CORE_APIConfig.coreAPI.searchOrganizationUser + "/ou_oid/" + restfulParams.o_id,
        //             method: 'POST',
        //             data:{
        //                 fields:['ou_uid'].join(',')
        //             }
        //         },
        //         function (err, data) {
        //             console.log(222,data);
        //             resultData.organizationUserId = data.data[0].ou_uid;

        //             cb();
        //         }
        //     );

        // },
        function (cb) {

            R.SEND_HTTP(
                req,
                {
                    url: CORE_APIConfig.coreAPI.searchOrganizationFinanceInfo + "/ofi_oid/" + restfulParams.o_id,
                    method: 'POST'
                },
                function (err, data) {

                    //console.log(data);
                    console.log(333,data);
                    resultData.financeData = data.data[0];

                    cb();
                }
            );

        },

        //获取可提现的额度
        function (cb) {

            R.SEND_HTTP(
                req,
                {
                    url: CORE_APIConfig.coreAPI.withdrawalBalance,
                    method: 'POST',
                    data: {
                        wdr_oid: restfulParams.o_id
                    }
                },
                function (err, data) {

                    //console.log(data);
                    console.log(444,data);
                    resultData.diffMoney = data.data.diff;

                    cb();
                }
            );

        },

        //获取体现记录
        function (cb) {

            R.SEND_HTTP(
                req,
                {
                    url: CORE_APIConfig.coreAPI.searchWithdrawal + "/w_oid/" + restfulParams.o_id + "/sort_order/w_apply_time-desc",
                    method: 'POST'
                },
                function (err, data) {
                    console.log(555,data);
                    resultData.withdrawData = data.data;

                    cb();
                }
            );

        }


    ], function (err, result) {

        //返回最终拼接结果
        RES.response(res, true, resultData);

    });
}